<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			
			@keyframes rect{
				25%{
					transform: translate(100px,0);
				}
				50%{
					transform: translate(100px,100px);
				}
				75%{
					transform: translate(0px,100px);
				}
				100%{
					transform: translate(0px,200px);
				}
			}
			
			#box{
				width: 100px;
				height: 100px;
				background-color: red;
			}
			
			.animate-rect{
				animation-name: rect;
				animation-duration: 2s;
				animation-timing-function: linear;
				animation-fill-mode: both;
			}
			
		</style>
	</head>
	<body>
		<button onclick="move()">动画</button>
		
		<div id="box">
			
		</div>
	</body>
	<script>
		var box = document.getElementById("box");

		box.addEventListener("animationend",function(){
			alert("动画结束了");
		})
		
		function move(){
			box.classList.add("animate-rect");
		}
		
		
	</script>
</html>
